<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>兴趣交友 - 发现志同道合的朋友</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #4f46e5;
            --primary-light: #818cf8;
            --primary-dark: #3730a3;
            --secondary: #10b981;
            --accent: #f59e0b;
            --danger: #ef4444;
            --text-primary: #1f2937;
            --text-secondary: #6b7280;
            --text-light: #9ca3af;
            --bg-light: #f3f4f6;
            --bg-white: #ffffff;
            --border-light: #e5e7eb;
            --radius: 12px;
            --shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 55px;
            padding-bottom: 70px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 55px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 15px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
            box-shadow: var(--shadow);
        }
        
        .nav-title {
            font-size: 1.15rem;
            font-weight: 600;
            color: var(--primary-dark);
        }
        
        .nav-action {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1.2rem;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .nav-action:hover {
            background-color: var(--bg-light);
        }
        
        /* 搜索栏 */
        .search-container {
            padding: 12px 15px;
            background-color: var(--bg-white);
        }
        
        .search-group {
            position: relative;
        }
        
        .search-input {
            width: 100%;
            padding: 12px 15px 12px 45px;
            border-radius: 30px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 0.9rem;
        }
        
        .search-input:focus {
            outline: none;
            border-color: var(--primary-light);
            box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
        }
        
        .search-icon {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }
        
        /* 筛选区域 */
        .filters-container {
            background-color: var(--bg-white);
            border-top: 1px solid var(--border-light);
        }
        
        .filter-title {
            font-size: 0.9rem;
            color: var(--text-secondary);
            padding: 12px 15px 8px;
            font-weight: 500;
        }
        
        /* 兴趣分类筛选 */
        .interest-filter {
            display: flex;
            padding: 8px 15px;
            background-color: var(--bg-white);
            overflow-x: auto;
            scrollbar-width: none;
        }
        
        .interest-filter::-webkit-scrollbar {
            display: none;
        }
        
        .interest-item {
            white-space: nowrap;
            padding: 6px 14px;
            margin-right: 8px;
            border-radius: 20px;
            font-size: 0.85rem;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: none;
            display: flex;
            align-items: center;
        }
        
        .interest-item.active {
            background-color: var(--primary);
            color: white;
        }
        
        .interest-item i {
            margin-right: 5px;
        }
        
        /* 条件筛选器 */
        .advanced-filters {
            padding: 10px 15px;
            background-color: var(--bg-white);
            border-top: 1px solid var(--border-light);
        }
        
        .filter-row {
            display: flex;
            gap: 10px;
            margin-bottom: 10px;
        }
        
        .filter-group {
            flex: 1;
        }
        
        .filter-label {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-bottom: 5px;
            display: block;
        }
        
        .filter-select {
            width: 100%;
            padding: 8px 12px;
            border-radius: 8px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 0.85rem;
            color: var(--text-primary);
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 10px center;
        }
        
        /* 筛选操作栏 */
        .filter-actions {
            display: flex;
            padding: 12px 15px;
            background-color: var(--bg-white);
            border-top: 1px solid var(--border-light);
            justify-content: space-between;
        }
        
        .reset-btn {
            padding: 8px 16px;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: none;
            border-radius: 8px;
            font-size: 0.9rem;
        }
        
        .apply-btn {
            padding: 8px 16px;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 0.9rem;
        }
        
        /* 活跃筛选标签 */
        .active-filters {
            padding: 10px 15px;
            background-color: var(--bg-white);
            border-top: 1px solid var(--border-light);
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
        }
        
        .active-filter-tag {
            background-color: rgba(79, 70, 229, 0.1);
            color: var(--primary);
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .remove-filter {
            background: none;
            border: none;
            color: var(--primary);
            cursor: pointer;
            font-size: 0.9rem;
        }
        
        .clear-all {
            color: var(--text-secondary);
            font-size: 0.8rem;
            margin-left: auto;
            background: none;
            border: none;
        }
        
        /* 交友列表 */
        .friends-list {
            padding: 0 15px;
        }
        
        .friend-card {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            margin-top: 12px;
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: transform 0.2s ease;
        }
        
        .friend-card:hover {
            transform: translateY(-2px);
        }
        
        .card-header {
            padding: 15px;
            display: flex;
            align-items: center;
            gap: 12px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .avatar-container {
            position: relative;
        }
        
        .user-avatar {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid var(--bg-white);
        }
        
        .online-status {
            position: absolute;
            bottom: 0;
            right: 0;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background-color: var(--secondary);
            border: 2px solid var(--bg-white);
        }
        
        .offline-status {
            background-color: var(--text-light);
        }
        
        .user-info {
            flex: 1;
        }
        
        .user-name {
            font-size: 1.05rem;
            font-weight: 600;
            margin-bottom: 3px;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .user-age {
            color: var(--text-secondary);
            font-weight: normal;
            font-size: 0.9rem;
        }
        
        .user-location {
            font-size: 0.8rem;
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .user-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            margin-top: 5px;
        }
        
        .user-tag {
            background-color: rgba(79, 70, 229, 0.1);
            color: var(--primary);
            font-size: 0.75rem;
            padding: 2px 8px;
            border-radius: 10px;
        }
        
        /* 无图样式 */
        .friend-card.no-media .card-body {
            padding: 15px;
        }
        
        /* 单图样式 */
        .friend-card.single-media .media-container {
            height: 200px;
        }
        
        /* 多图样式 */
        .media-container {
            width: 100%;
            position: relative;
        }
        
        .media-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .multi-media {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 2px;
            height: 180px;
        }
        
        .multi-media img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .media-count {
            position: absolute;
            right: 8px;
            bottom: 8px;
            background-color: rgba(0, 0, 0, 0.6);
            color: white;
            font-size: 0.75rem;
            padding: 2px 8px;
            border-radius: 10px;
        }
        
        /* 个人简介 */
        .card-body {
            padding: 0;
        }
        
        .user-bio {
            padding: 15px;
            font-size: 0.9rem;
            line-height: 1.5;
            color: var(--text-primary);
            border-bottom: 1px solid var(--border-light);
        }
        
        .bio-highlight {
            color: var(--primary);
            font-weight: 500;
        }
        
        /* 共同兴趣 */
        .common-interests {
            padding: 12px 15px;
            background-color: var(--bg-light);
            font-size: 0.85rem;
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .interests-list {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
        }
        
        .interest-tag {
            background-color: white;
            color: var(--text-primary);
            font-size: 0.8rem;
            padding: 2px 8px;
            border-radius: 10px;
        }
        
        /* 操作按钮 */
        .action-buttons {
            display: flex;
            gap: 10px;
            padding: 12px 15px;
        }
        
        .primary-btn {
            flex: 1;
            padding: 10px 0;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
        }
        
        .primary-btn:hover {
            background-color: var(--primary-dark);
        }
        
        .secondary-btn {
            flex: 1;
            padding: 10px 0;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: 1px solid var(--border-light);
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
        }
        
        /* 加载更多 */
        .load-more {
            width: 100%;
            padding: 12px;
            margin: 15px 0;
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            border-radius: var(--radius);
            color: var(--text-secondary);
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            text-decoration: none;
        }
        
        .nav-item i {
            font-size: 1.3rem;
            margin-bottom: 3px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 提示消息 */
        .toast-notification {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            z-index: 9999;
            font-size: 0.9rem;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast-notification.show {
            opacity: 1;
        }
        
        /* 空状态 */
        .empty-state {
            padding: 40px 20px;
            text-align: center;
            color: var(--text-secondary);
        }
        
        .empty-icon {
            font-size: 3rem;
            margin-bottom: 15px;
            color: var(--text-light);
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-action" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">兴趣交友</div>
        <button class="nav-action" id="filterToggle">
            <i class="fas fa-sliders-h"></i>
        </button>
    </div>
    
    <!-- 搜索栏 -->
    <div class="search-container">
        <div class="search-group">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索兴趣、用户名...">
        </div>
    </div>
    
    <!-- 筛选区域 -->
    <div class="filters-container" id="filtersContainer">
        <!-- 兴趣分类筛选 -->
        <div class="filter-title">按兴趣筛选</div>
        <div class="interest-filter">
            <button class="interest-item active">
                <i class="fas fa-th"></i>全部
            </button>
            <button class="interest-item">
                <i class="fas fa-music"></i>音乐
            </button>
            <button class="interest-item">
                <i class="fas fa-book"></i>阅读
            </button>
            <button class="interest-item">
                <i class="fas fa-film"></i>电影
            </button>
            <button class="interest-item">
                <i class="fas fa-gamepad"></i>游戏
            </button>
            <button class="interest-item">
                <i class="fas fa-hiking"></i>户外
            </button>
            <button class="interest-item">
                <i class="fas fa-utensils"></i>美食
            </button>
            <button class="interest-item">
                <i class="fas fa-paint-brush"></i>艺术
            </button>
        </div>
        
        <!-- 条件筛选 -->
        <div class="filter-title">按条件筛选</div>
        <div class="advanced-filters">
            <div class="filter-row">
                <div class="filter-group">
                    <label class="filter-label">性别</label>
                    <select class="filter-select" id="gender">
                        <option value="all">不限</option>
                        <option value="male">男</option>
                        <option value="female">女</option>
                    </select>
                </div>
                <div class="filter-group">
                    <label class="filter-label">年龄范围</label>
                    <select class="filter-select" id="ageRange">
                        <option value="all">不限</option>
                        <option value="18-25">18-25岁</option>
                        <option value="26-35">26-35岁</option>
                        <option value="36-45">36-45岁</option>
                        <option value="46+">46岁以上</option>
                    </select>
                </div>
            </div>
            <div class="filter-row">
                <div class="filter-group">
                    <label class="filter-label">距离</label>
                    <select class="filter-select" id="distance">
                        <option value="all">不限</option>
                        <option value="1km">1公里内</option>
                        <option value="5km">5公里内</option>
                        <option value="10km">10公里内</option>
                        <option value="50km">50公里内</option>
                    </select>
                </div>
                <div class="filter-group">
                    <label class="filter-label">在线状态</label>
                    <select class="filter-select" id="onlineStatus">
                        <option value="all">全部</option>
                        <option value="online">在线</option>
                        <option value="recent">最近活跃</option>
                    </select>
                </div>
            </div>
        </div>
        
        <!-- 筛选操作 -->
        <div class="filter-actions">
            <button class="reset-btn" id="resetFilters">重置筛选</button>
            <button class="apply-btn" id="applyFilters">应用筛选</button>
        </div>
    </div>
    
    <!-- 活跃筛选标签 -->
    <div class="active-filters" id="activeFilters">
        <div class="active-filter-tag">
            音乐
            <button class="remove-filter"><i class="fas fa-times"></i></button>
        </div>
        <div class="active-filter-tag">
            26-35岁
            <button class="remove-filter"><i class="fas fa-times"></i></button>
        </div>
        <div class="active-filter-tag">
            10公里内
            <button class="remove-filter"><i class="fas fa-times"></i></button>
        </div>
        <button class="clear-all">清除全部</button>
    </div>
    
    <!-- 交友列表 -->
    <div class="friends-list" id="friendsList">
        <!-- 多图样式 -->
        <div class="friend-card multi-media-card">
            <div class="card-header">
                <div class="avatar-container">
                    <img src="https://picsum.photos/id/64/200/200" alt="用户头像" class="user-avatar">
                    <div class="online-status"></div>
                </div>
                <div class="user-info">
                    <div class="user-name">
                        音乐旅人 <span class="user-age">(28)</span>
                    </div>
                    <div class="user-location">
                        <i class="fas fa-map-marker-alt"></i> 5.2公里
                    </div>
                    <div class="user-tags">
                        <span class="user-tag">独立音乐</span>
                        <span class="user-tag">旅行</span>
                        <span class="user-tag">摄影</span>
                    </div>
                </div>
            </div>
            
            <div class="media-container">
                <div class="multi-media">
                    <img src="https://picsum.photos/id/1068/300/300" alt="用户分享图片1">
                    <img src="https://picsum.photos/id/1059/300/300" alt="用户分享图片2">
                    <img src="https://picsum.photos/id/1073/300/300" alt="用户分享图片3">
                </div>
                <div class="media-count">+5</div>
            </div>
            
            <div class="user-bio">
                热爱独立音乐和城市探索，周末常去livehouse和咖啡馆。最近在学习吉他，希望找到能一起交流音乐的朋友 <span class="bio-highlight">#寻找音乐搭子#</span>
            </div>
            
            <div class="common-interests">
                <i class="fas fa-heart text-primary"></i>
                <div class="interests-list">
                    <span class="interest-tag">独立音乐</span>
                    <span class="interest-tag">摄影</span>
                    <span class="interest-tag">咖啡馆探店</span>
                </div>
                <span>3个共同兴趣</span>
            </div>
            
            <div class="action-buttons">
                <button class="secondary-btn dislike-btn">
                    <i class="fas fa-times"></i> 不感兴趣
                </button>
                <button class="primary-btn connect-btn">
                    <i class="fas fa-comment"></i> 打招呼
                </button>
            </div>
        </div>
        
        <!-- 无图样式 -->
        <div class="friend-card no-media">
            <div class="card-header">
                <div class="avatar-container">
                    <img src="https://picsum.photos/id/91/200/200" alt="用户头像" class="user-avatar">
                    <div class="online-status offline-status"></div>
                </div>
                <div class="user-info">
                    <div class="user-name">
                        书虫一枚 <span class="user-age">(32)</span>
                    </div>
                    <div class="user-location">
                        <i class="fas fa-map-marker-alt"></i> 8.7公里
                    </div>
                    <div class="user-tags">
                        <span class="user-tag">文学</span>
                        <span class="user-tag">诗歌</span>
                        <span class="user-tag">读书会</span>
                    </div>
                </div>
            </div>
            
            <div class="card-body">
                <div class="user-bio">
                    文学编辑，每周组织线上读书会，偏爱现当代诗歌和散文。希望认识同样喜欢文字的朋友，一起交流阅读心得 <span class="bio-highlight">#文字爱好者#</span>
                </div>
                
                <div class="common-interests">
                    <i class="fas fa-heart text-primary"></i>
                    <div class="interests-list">
                        <span class="interest-tag">读书会</span>
                        <span class="interest-tag">散文</span>
                    </div>
                    <span>2个共同兴趣</span>
                </div>
            </div>
            
            <div class="action-buttons">
                <button class="secondary-btn dislike-btn">
                    <i class="fas fa-times"></i> 不感兴趣
                </button>
                <button class="primary-btn connect-btn">
                    <i class="fas fa-comment"></i> 打招呼
                </button>
            </div>
        </div>
        
        <!-- 单图样式 -->
        <div class="friend-card single-media">
            <div class="card-header">
                <div class="avatar-container">
                    <img src="https://picsum.photos/id/26/200/200" alt="用户头像" class="user-avatar">
                    <div class="online-status"></div>
                </div>
                <div class="user-info">
                    <div class="user-name">
                        户外探险家 <span class="user-age">(30)</span>
                    </div>
                    <div class="user-location">
                        <i class="fas fa-map-marker-alt"></i> 3.5公里
                    </div>
                    <div class="user-tags">
                        <span class="user-tag">徒步</span>
                        <span class="user-tag">露营</span>
                        <span class="user-tag">摄影</span>
                    </div>
                </div>
            </div>
            
            <div class="media-container">
                <img src="https://picsum.photos/id/29/800/400" alt="用户分享图片" class="media-image">
            </div>
            
            <div class="user-bio">
                户外摄影师，每月至少一次露营或徒步旅行。最近在探索周边的小众路线，寻找有共同爱好的伙伴一起出行 <span class="bio-highlight">#户外爱好者#</span>
            </div>
            
            <div class="common-interests">
                <i class="fas fa-heart text-primary"></i>
                <div class="interests-list">
                    <span class="interest-tag">摄影</span>
                </div>
                <span>1个共同兴趣</span>
            </div>
            
            <div class="action-buttons">
                <button class="secondary-btn dislike-btn">
                    <i class="fas fa-times"></i> 不感兴趣
                </button>
                <button class="primary-btn connect-btn">
                    <i class="fas fa-comment"></i> 打招呼
                </button>
            </div>
        </div>
        
        <!-- 无图简约样式 -->
        <div class="friend-card no-media">
            <div class="card-header">
                <div class="avatar-container">
                    <img src="https://picsum.photos/id/65/200/200" alt="用户头像" class="user-avatar">
                    <div class="online-status offline-status"></div>
                </div>
                <div class="user-info">
                    <div class="user-name">
                        咖啡控 <span class="user-age">(27)</span>
                    </div>
                    <div class="user-location">
                        <i class="fas fa-map-marker-alt"></i> 2.1公里
                    </div>
                    <div class="user-tags">
                        <span class="user-tag">咖啡</span>
                        <span class="user-tag">烘焙</span>
                        <span class="user-tag">美食</span>
                    </div>
                </div>
            </div>
            
            <div class="card-body">
                <div class="user-bio">
                    咖啡师，喜欢尝试各种手冲咖啡，周末会在家做烘焙。想找能一起探店打卡的朋友，分享咖啡和美食的乐趣 <span class="bio-highlight">#咖啡爱好者#</span>
                </div>
                
                <div class="common-interests">
                    <i class="fas fa-heart text-primary"></i>
                    <div class="interests-list">
                        <span class="interest-tag">美食</span>
                    </div>
                    <span>1个共同兴趣</span>
                </div>
            </div>
            
            <div class="action-buttons">
                <button class="secondary-btn dislike-btn">
                    <i class="fas fa-times"></i> 不感兴趣
                </button>
                <button class="primary-btn connect-btn">
                    <i class="fas fa-comment"></i> 打招呼
                </button>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <button class="load-more" id="loadMore">
            <i class="fas fa-spinner fa-spin"></i>
            <span>加载更多朋友</span>
        </button>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-users"></i>
            <span>交友</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item">
            <i class="far fa-user"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 筛选面板切换
        const filterToggle = document.getElementById('filterToggle');
        const filtersContainer = document.getElementById('filtersContainer');
        
        filterToggle.addEventListener('click', () => {
            if (filtersContainer.style.display === 'none') {
                filtersContainer.style.display = 'block';
                showToast('显示筛选面板');
            } else {
                filtersContainer.style.display = 'none';
                showToast('隐藏筛选面板');
            }
        });
        
        // 兴趣分类筛选切换
        const interestItems = document.querySelectorAll('.interest-item');
        interestItems.forEach(item => {
            item.addEventListener('click', () => {
                interestItems.forEach(i => i.classList.remove('active'));
                item.classList.add('active');
                updateActiveFilters();
            });
        });
        
        // 应用筛选
        document.getElementById('applyFilters').addEventListener('click', () => {
            applyFilters();
            filtersContainer.style.display = 'none';
        });
        
        // 重置筛选
        document.getElementById('resetFilters').addEventListener('click', () => {
            // 重置兴趣分类
            interestItems.forEach(i => i.classList.remove('active'));
            interestItems[0].classList.add('active');
            
            // 重置下拉选择
            document.getElementById('gender').value = 'all';
            document.getElementById('ageRange').value = 'all';
            document.getElementById('distance').value = 'all';
            document.getElementById('onlineStatus').value = 'all';
            
            // 更新活跃筛选标签
            updateActiveFilters(true);
            
            showToast('已重置所有筛选条件');
        });
        
        // 清除单个筛选条件
        document.querySelectorAll('.remove-filter').forEach(btn => {
            btn.addEventListener('click', (e) => {
                e.stopPropagation();
                const tag = btn.closest('.active-filter-tag');
                const filterText = tag.textContent.trim();
                tag.remove();
                
                // 这里可以根据实际筛选条件移除对应的筛选状态
                showToast(`已移除筛选: ${filterText}`);
                
                // 如果没有筛选条件了，隐藏活跃筛选栏
                if (document.querySelectorAll('.active-filter-tag').length === 0) {
                    document.getElementById('activeFilters').style.display = 'none';
                }
                
                // 重新应用筛选
                applyFilters();
            });
        });
        
        // 清除全部筛选条件
        document.querySelector('.clear-all').addEventListener('click', () => {
            document.getElementById('resetFilters').click();
            document.getElementById('activeFilters').innerHTML = `
                <button class="clear-all">清除全部</button>
            `;
        });
        
        // 更新活跃筛选标签
        function updateActiveFilters(reset = false) {
            if (reset) {
                document.getElementById('activeFilters').innerHTML = `
                    <button class="clear-all">清除全部</button>
                `;
                return;
            }
            
            // 获取选中的兴趣分类
            const activeInterest = document.querySelector('.interest-item.active:not(:first-child)');
            
            // 获取选中的条件
            const ageRange = document.getElementById('ageRange');
            const selectedAgeRange = ageRange.options[ageRange.selectedIndex].text;
            
            const distance = document.getElementById('distance');
            const selectedDistance = distance.options[distance.selectedIndex].text;
            
            // 构建活跃筛选标签
            let activeFiltersHTML = '';
            
            if (activeInterest) {
                activeFiltersHTML += `
                    <div class="active-filter-tag">
                        ${activeInterest.textContent.trim()}
                        <button class="remove-filter"><i class="fas fa-times"></i></button>
                    </div>
                `;
            }
            
            if (ageRange.value !== 'all') {
                activeFiltersHTML += `
                    <div class="active-filter-tag">
                        ${selectedAgeRange}
                        <button class="remove-filter"><i class="fas fa-times"></i></button>
                    </div>
                `;
            }
            
            if (distance.value !== 'all') {
                activeFiltersHTML += `
                    <div class="active-filter-tag">
                        ${selectedDistance}
                        <button class="remove-filter"><i class="fas fa-times"></i></button>
                    </div>
                `;
            }
            
            activeFiltersHTML += `<button class="clear-all">清除全部</button>`;
            
            document.getElementById('activeFilters').innerHTML = activeFiltersHTML;
            
            // 重新绑定清除单个筛选条件的事件
            document.querySelectorAll('.remove-filter').forEach(btn => {
                btn.addEventListener('click', (e) => {
                    e.stopPropagation();
                    const tag = btn.closest('.active-filter-tag');
                    const filterText = tag.textContent.trim();
                    tag.remove();
                    showToast(`已移除筛选: ${filterText}`);
                    applyFilters();
                });
            });
            
            // 重新绑定清除全部筛选条件的事件
            document.querySelector('.clear-all').addEventListener('click', () => {
                document.getElementById('resetFilters').click();
                document.getElementById('activeFilters').innerHTML = `
                    <button class="clear-all">清除全部</button>
                `;
            });
            
            // 显示活跃筛选栏
            document.getElementById('activeFilters').style.display = 'flex';
        }
        
        // 应用筛选条件
        function applyFilters() {
            // 获取所有筛选条件
            const activeInterest = document.querySelector('.interest-item.active').textContent.trim();
            const gender = document.getElementById('gender').value;
            const ageRange = document.getElementById('ageRange').value;
            const distance = document.getElementById('distance').value;
            const onlineStatus = document.getElementById('onlineStatus').value;
            
            // 显示加载状态
            const friendsList = document.getElementById('friendsList');
            friendsList.innerHTML = `
                <div class="d-flex justify-content-center p-5">
                    <div class="spinner-border text-primary" role="status">
                        <span class="visually-hidden">Loading...</span>
                    </div>
                </div>
            `;
            
            // 模拟筛选延迟
            setTimeout(() => {
                // 在实际应用中，这里会根据筛选条件从服务器请求数据
                // 这里简单恢复原始列表
                friendsList.innerHTML = document.getElementById('friendsList').dataset.originalContent;
                
                // 构建筛选描述文本
                let filterDesc = [];
                if (activeInterest !== '全部') filterDesc.push(activeInterest);
                if (ageRange !== 'all') filterDesc.push(document.getElementById('ageRange').options[document.getElementById('ageRange').selectedIndex].text);
                if (distance !== 'all') filterDesc.push(document.getElementById('distance').options[document.getElementById('distance').selectedIndex].text);
                
                const filterText = filterDesc.length > 0 ? 
                    `已找到 ${Math.floor(Math.random() * 20) + 5} 位符合条件的朋友` : 
                    '已显示全部朋友';
                
                showToast(filterText);
                
                // 重新绑定事件
                bindEvents();
            }, 1000);
        }
        
        // 绑定交互事件
        function bindEvents() {
            // 打招呼按钮
            const connectButtons = document.querySelectorAll('.connect-btn:not([data-bound])');
            connectButtons.forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', () => {
                    const userName = btn.closest('.friend-card').querySelector('.user-name').textContent.split(' ')[0];
                    showToast(`已向 ${userName} 发送招呼`);
                    
                    // 更改按钮状态
                    btn.innerHTML = '<i class="fas fa-check"></i> 已发送';
                    btn.disabled = true;
                    btn.style.backgroundColor = var(--secondary);
                });
            });
            
            // 不感兴趣按钮
            const dislikeButtons = document.querySelectorAll('.dislike-btn:not([data-bound])');
            dislikeButtons.forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', () => {
                    const card = btn.closest('.friend-card');
                    const userName = card.querySelector('.user-name').textContent.split(' ')[0];
                    
                    // 添加淡出动画
                    card.style.transition = 'opacity 0.3s ease, transform 0.3s ease';
                    card.style.opacity = '0';
                    card.style.transform = 'translateX(-20px)';
                    
                    setTimeout(() => {
                        card.remove();
                        showToast(`已隐藏 ${userName}`);
                    }, 300);
                });
            });
            
            // 加载更多
            document.getElementById('loadMore').addEventListener('click', function() {
                const btn = this;
                const originalText = btn.innerHTML;
                btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i><span>加载中...</span>';
                btn.disabled = true;
                
                // 模拟加载延迟
                setTimeout(() => {
                    btn.innerHTML = originalText;
                    btn.disabled = false;
                    showToast('已加载更多朋友');
                    
                    // 复制第一个朋友卡片并修改内容
                    const friendsList = document.getElementById('friendsList');
                    const firstCard = friendsList.querySelector('.friend-card:first-of-type');
                    
                    if (firstCard) {
                        const clone = firstCard.cloneNode(true);
                        // 修改一些内容以示区别
                        const randomId = Math.floor(Math.random() * 100) + 200;
                        clone.querySelector('.user-avatar').src = `https://picsum.photos/id/${randomId}/200/200`;
                        
                        // 随机更改在线状态
                        const statusElem = clone.querySelector('.online-status');
                        if (Math.random() > 0.5) {
                            statusElem.classList.remove('offline-status');
                        } else {
                            statusElem.classList.add('offline-status');
                        }
                        
                        // 插入到加载更多按钮前
                        friendsList.insertBefore(clone, btn);
                        
                        // 重新绑定事件
                        bindEvents();
                    }
                }, 1500);
            });
        }
        
        // 返回按钮
        document.getElementById('backBtn').addEventListener('click', () => {
            showToast('返回上一页');
        });
        
        // 提示消息
        function showToast(message) {
            // 检查是否已有toast
            let toast = document.querySelector('.toast-notification');
            if (toast) {
                toast.remove();
            }
            
            // 创建新toast
            toast = document.createElement('div');
            toast.className = 'toast-notification';
            toast.textContent = message;
            
            document.body.appendChild(toast);
            
            // 显示toast
            setTimeout(() => {
                toast.classList.add('show');
            }, 10);
            
            // 3秒后隐藏并移除
            setTimeout(() => {
                toast.classList.remove('show');
                setTimeout(() => toast.remove(), 300);
            }, 3000);
        }
        
        // 页面加载完成后保存原始列表内容
        window.addEventListener('DOMContentLoaded', () => {
            document.getElementById('friendsList').dataset.originalContent = document.getElementById('friendsList').innerHTML;
            bindEvents();
        });
    </script>
</body>
</html>

